<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>学生列表在此---list</title>
</head>
<body>
	<%@ include file="/WEB-INF/views/header.jsp" %>
	<jsp:include page="/WEB-INF/views/header.jsp"/>
	<table>
		<caption>list.jsp</caption>
		<tr>
			<th>学号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>编辑</th>
		</tr>
		<c:choose>
			<c:when test="${not empty requestScope.pi }">
			
			<c:forEach items="${requestScope.pi.list }" var="stu">
					<tr>
						<td><c:out value="${stu.stuId }"/></td>
						<td><c:out value="${stu.stuName }" /></td>
						<td>${stu.stuAge }</td>
						<td>
							<a href="/delete/${stu.stuId }">删除</a>|
							<a href="/update/${stu.stuId }">修改</a>
						</td>
					</tr>
			</c:forEach>
			<div>
			<c:if test="${pi.hasPreviousPage }">
				<a href="/students?p=${pi.pageNum -1 }">上一页</a>
			</c:if>
			<c:forEach begin="1" end="${pi.pages }" step="1" var="i">
				<a href="/students?p=${i }">${i }</a>
			</c:forEach>
			<c:if test="${pi.hasNextPage }">
				<a href="/students?p=${pi.pageNum +1 }">下一页</a>
			</c:if>
			共${pi.total }条/共${pi.pages }页
			</div>
			</c:when>
			
			<c:otherwise>
				
			</c:otherwise>
		</c:choose>
	</table>
</body>
</html>